package com.nidu.demo.oauth2;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.oauth2.dto.OAuth2ClientAddCmd;
import com.nidu.demo.oauth2.dto.OAuth2ClientListQry;
import com.nidu.demo.oauth2.dto.OAuth2ClientPageQry;
import com.nidu.demo.oauth2.dto.OAuth2ClientUpdateCmd;
import com.nidu.demo.oauth2.api.OAuth2ClientService;
import com.nidu.demo.oauth2.dto.OAuth2ClientCO;
import com.nidu.demo.oauth2.executor.command.OAuth2ClientAddCmdExe;
import com.nidu.demo.oauth2.executor.command.OAuth2ClientDeleteCmdExe;
import com.nidu.demo.oauth2.executor.command.OAuth2ClientUpdateCmdExe;
import com.nidu.demo.oauth2.executor.query.OAuth2ClientListQryExe;
import com.nidu.demo.oauth2.executor.query.OAuth2ClientPageQryExe;
import com.nidu.demo.oauth2.executor.query.OAuth2ClientSingleQryExe;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

@Service
@RequiredArgsConstructor
public class OAuth2ClientServiceImpl implements OAuth2ClientService {

    private final OAuth2ClientAddCmdExe addCmdExe;
    private final OAuth2ClientUpdateCmdExe updateCmdExe;
    private final OAuth2ClientDeleteCmdExe deleteCmdExe;
    private final OAuth2ClientSingleQryExe singleQryExe;
    private final OAuth2ClientListQryExe listQryExe;
    private final OAuth2ClientPageQryExe pageQryExe;

    @Override
    public SingleResponse<OAuth2ClientCO> add(OAuth2ClientAddCmd cmd) {
        return addCmdExe.execute(cmd);
    }

    @Override
    public SingleResponse<OAuth2ClientCO> update(OAuth2ClientUpdateCmd cmd) {
        return updateCmdExe.execute(cmd);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<OAuth2ClientCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public MultiResponse<OAuth2ClientCO> list(OAuth2ClientListQry qry) {
        return listQryExe.execute(qry);
    }

    @Override
    public PageResponse<OAuth2ClientCO> page(OAuth2ClientPageQry pageQry) {
        return pageQryExe.execute(pageQry);
    }
}
